package com.boyinet.demo.pipelineleakage.config;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class TokenCacheConfig {

    @Bean
    public Cache<String, String> tokenCache() {
        return CacheBuilder.newBuilder()
                .concurrencyLevel(Runtime.getRuntime().availableProcessors())
                .expireAfterAccess(7, TimeUnit.DAYS)
                .maximumSize(1000)
                .build();
    }
}
